/* eslint-disable @ngrx/no-typed-global-store */
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { selectEditor } from '../../../../../app/state/editor/selectors/editor-selector';
import { SelectedGraphObjectState } from '../../../../../app/state/editor/models/editor-model';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs/internal/Observable';
import * as _G6 from '@antv/g6'
@Component({
  selector: 'dws-graph-options',
  templateUrl: './graph-options.component.html',
  styleUrls: ['./graph-options.component.scss']
})
export class GraphOptionsComponent implements OnInit {
  public type$: Observable<'NODE' | 'EDGE' | 'CANVAS'|'COMBO'>;
  public obj$: Observable<_G6.Node | _G6.Edge>;

  constructor(private _store: Store<SelectedGraphObjectState>) {
    // eslint-disable-next-line no-underscore-dangle, @ngrx/avoid-mapping-selectors
    this.type$ = this._store.select(selectEditor).pipe(map(x => x.type));
    // eslint-disable-next-line no-underscore-dangle, @ngrx/avoid-mapping-selectors
    this._store.select(selectEditor).subscribe(data => {
      console.log('==changed===');
      console.log(data);
    })

  }

  ngOnInit(): void {
  }

}
